Fix anonymous functions in hooks#158
Conversation
| (defn- normalise-sym | ||
| [x] | ||
| (if (symbol? x) | ||
| (symbol (string/replace (str x) #"^((p\d+|rest))(__\d+)#$" "$1__#")) |
There was a problem hiding this comment.
IIUC this string/replace takes a value like p123__456# and returns p123__#, and this works because the pX number is related to the place within the form. Did I get that right?
I am curious if the pX is local to the binding form, or to the file, or global. I could see any of them being reasonable. I think best for us would be local to the binding form, because it would mean edits to other places in the same file/project wouldn't bust the fast refresh cache. I think no matter what, this is better than what we had before!
There was a problem hiding this comment.
The first number is the index of the parameter, yep. So % corresponds to p1, so does %1. %2 corresponds to p2 etc.
And obviously %& corresponds to rest.
So local to the function bindings.
Fix #117